package com.itheima.day18.注解.注解Test.注解TestDemo2;

import java.lang.reflect.Method;

public class TestAnnotation {
    public static void main(String[] args) throws Exception {
        Class clazz = Class.forName("com.itheima.day18.注解.注解Test.注解TestDemo2.UserTest");
        UserTest userTest = (UserTest) clazz.newInstance();
        Method[] methods = clazz.getDeclaredMethods();
        for (Method method : methods) {
            method.setAccessible(true);
            if(method.isAnnotationPresent(Test.class)){

                method.invoke(userTest);
            }
        }
    }
}
